/**
 * 
 */
package com.avecsys.quotemanager.dao.common;

import java.io.File;
import java.sql.Blob;
import java.util.List;
import java.util.Map;

import org.springframework.orm.hibernate3.HibernateTemplate;

import com.avecsys.quotemanager.exception.DAOException;
import com.avecsys.quotemanager.pojos.BasePojo;
import com.avecsys.quotemanager.utils.TransactionStatus;

/**
 * @author sam sundar K
 */
public interface BaseDAO
{

	/**
	 * Method to insert a new record
	 * 
	 * @param persistantPojo
	 * @return TransactionStatus
	 * @throws DAOException
	 */
	public TransactionStatus save(final BasePojo persistantPojo) throws DAOException;

	/**
	 * Method to update an existing record
	 * 
	 * @param persistantPojo
	 * @return
	 * @throws DAOException
	 */
	public TransactionStatus update(final BasePojo persistantPojo) throws DAOException;

	/**
	 * Method to delete the persisted object
	 * 
	 * @param basePojo
	 * @return TransactionStatus
	 * @throws DAOException
	 */
	public TransactionStatus delete(final BasePojo basePojo) throws DAOException;

	/**
	 * Method to mark the record as delete with status 'D'
	 * 
	 * @param instance
	 * @return TransactionStatus
	 * @throws DAOException
	 */
	public TransactionStatus markAsDeleted(final BasePojo instance) throws DAOException;

	/**
	 * Method to get any SubClass of BasePojo instance by Pk
	 * 
	 * @param BasePojo
	 * @param Pk
	 * @return BasePojo
	 * @throws DAOException
	 */
	public BasePojo findById(BasePojo basePojo, Long Pk) throws DAOException;

	/**
	 * Method to get any SubClass of BasePojo instance with status 'A' by Pk
	 * 
	 * @param BasePojo
	 * @param Pk
	 * @return BasePojo
	 * @throws DAOException
	 */
	public BasePojo findActiveById(BasePojo instance, Long Pk) throws DAOException;

	public List findAll(BasePojo basePojo) throws DAOException;

	/**
	 * Method to get all active record instance
	 * 
	 * @param basePojo
	 * @return List of Persisted Instances
	 * @throws DAOException
	 */
	public List findAllActive(BasePojo basePojo) throws DAOException;

	/**
	 * Method to find all active SubClass record instances based on criteria
	 * 
	 * @param basePojo
	 * @param criteria
	 * @return List
	 * @throws DAOException
	 */
	public List findAllActiveByCriteria(BasePojo basePojo, Map<String, Object> criteria)
			throws DAOException;

	/**
	 * Method to convert a java.io.File Object instance to java.sql.Blob
	 * 
	 * @param file
	 * @return Blob
	 * @throws DAOException
	 */
	public Blob getBlob(File file) throws DAOException;

	public HibernateTemplate getHibernateTemplate();

}
